var app = getApp();
const pathUrl = app.globalData.pathUrl;
const common = require('../../utils/common.js')
Page({
  data: {
    pathUrl: pathUrl,
    orderNo: '',
    array0: ['电子签约方式', '影像上传方式'],
    array: ['福州', '三明', '莆田', '南平', '宁德', '泉州', '漳州', '龙岩', '厦门'],
    number: '1408',
    pickerIndex: '5',
    orderPeriod: '泉州',
    array1: ['否', '是'],
    array2: ['抵押', '质押', '保证', '组合及其他', '先放款后抵押', '先抵押后放款', '阶段性保证+抵押', '第三方机构管理', '信用类'],
    number2: '6',
    pickerIndex2: '5',
    orderPeriod2: '先抵押后放款',
    dealer:'福建省新贝汽车贸易有限公司',
    dscode:'AAA001408140800450',
    mortname:'机动车登记证',
    array3: ['3', '6', '9', '12', '18', '24', '36', '48', '60'],
    array4: ['否', '是'],
    array5: ['本人', '父母', '配偶', '子女'],
    number5: '1',
    pickerIndex5: '0',
    orderPeriod5: '本人',
    array6: ['受托支付', '实体POS刷卡分期'],
    number6: '1',
    pickerIndex6: '0',
    orderPeriod6: '受托支付',
    array7: ['第三方机构', '合作单位', '第三方机构+合作单位'],
    number7: '20',
    pickerIndex7: '1',
    orderPeriod7: '合作单位',
    array8: ['合作结构', '融资担保机构', '保险机构'],
    number8: '1',
    pickerIndex8: '0',
    orderPeriod8: '合作结构',
    array9: ['贷款金额', '附加费'],
    array10: ['合作结构', '融资担保机构', '保险机构'],
    array11: ['贷款金额', '附加费'],
    array12: ['否', '是'],
    array13: ['贷款金额', '附加费'],
    isSubmit: true,
    flag: true,
    date2: '2020-01-01',
    date3: '2020-01-01',
    date4: '2020-01-01',
    recommendAgencyCode:'114010009',
    primnat: '156', //值为156
    bankCode: '0140808524',
    assurerNo: 'S14081592',
    platNo: 'qzyt',
    busiCode: '1001',
    productType: '1',
    downloadMode: '1',
  },
  onLoad: function (e) {
    var openId = wx.getStorageSync('openId');
    var orderNo = e.orderNo;
    var date = common.getToday();

    this.setData({
      // proNo: proNo,
      openId: openId,
      date: date,
      orderNo: orderNo
    })
    wx.setNavigationBarTitle({
      title: '分期进件'
    })
    this.getHrzxjj01();

    // this.getno();
    // this.getProAttList();
  },
  getHrzxjj01: function (e) {
    var that = this;
    var orderNo = that.data.orderNo;
    console.log(orderNo)
    wx.request({
      url: pathUrl + '/rest/hrzxjj01Controller/list/' + that.data.openId,
      data: {
        pageNumber: '1',
        pageSize: '100',
        orderNo: that.data.orderNo
      },
      success: function (e) {
        console.log(e)
        var list = e.data.data[0]
        console.log(list)
        that.setData({
          idCard: list.idCard,
          name: list.userName,
        })
      }
    })
  },
  //上传OCR图片
  upEnclosure: function (e) {
    var that = this;
    var sbtype = e.currentTarget.dataset.sbtype
    wx.chooseImage({
      count: 1, //最多可以选择的图片总数  
      sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有  
      sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有  
      success: function (res) {
        // 返回选定照片的本地文件路径列表，tempFilePath可以作为img标签的src属性显示图片  
        var tempFilePaths = res.tempFilePaths;
        //启动上传等待中...  
        wx.showToast({
          title: '正在上传...',
          icon: 'loading',
          mask: true,
          duration: 20000
        })
        var uploadImgCount = 0;
        for (var i = 0, h = tempFilePaths.length; i < h; i++) {
          wx.uploadFile({
            url: pathUrl + '/rest/base/uploadsb',
            filePath: tempFilePaths[i],
            name: 'uploadfile_ant',
            formData: {
              sbtype: sbtype,
              filetype: 'sb',
              orderNo: that.data.orderNo
            },
            header: {
              "Content-Type": "multipart/form-data"
            },
            success: function (res) {
              uploadImgCount++;
              console.log(res);
              if (sbtype == 2) {
                var data = JSON.parse(res.data);
                data = JSON.parse(data[0].piccontent);
                var items = data.result.cardsinfo[0].items;
                that.setData({
                  ocrName: items[1].content,
                  ocrSex: items[2].content,
                  ocrNation: items[3].content,
                  ocrBirth: items[4].content,
                  ocrAddress: items[5].content,
                  ocrIdNumber: items[6].content,
                })
                console.log("sbtype == 2:" + JSON.stringify(items))
              } else if (sbtype == 3) {
                var data = JSON.parse(res.data);
                data = JSON.parse(data[0].piccontent);
                var items = data.result.cardsinfo[0].items;
                that.setData({
                  ocrOffice: items[1].content,
                  ocrValidityPeriod: items[2].content,
                  cusIdValidfrom: items[3].content,
                  cusIdValidto: items[4].content
                })
                console.log("sbtype == 3:" + JSON.stringify(items))

              } else if (sbtype == 6) {
                var data = JSON.parse(res.data);
                data = JSON.parse(data[0].piccontent);
                var items = data.result.cardsinfo[0].items;
                that.setData({
                  carBrands: items[5].content,
                  carSeries: items[5].content,
                  carSpecs: items[5].content,
                  frameNo: items[6].content,
                  engineNo: items[7].content,
                })
                console.log("sbtype == 6:" + JSON.stringify(items))
              } else if (sbtype == 5) {
                var data = JSON.parse(res.data);
                data = JSON.parse(data[0].piccontent);
                var items = data.result.cardsinfo[0].items;
                that.setData({
                  holder: items[2].content,
                  dateIssue: items[6].content,
                  nature: items[7].content,
                  address: items[4].content,

                })
                console.log(data);
                console.log(items);
              }
              if (uploadImgCount == tempFilePaths.length) {
                wx.hideToast();
              }
            },
            fail: function (res) {
              wx.hideToast();
              wx.showModal({
                title: '错误提示',
                content: '上传图片失败',
                showCancel: false
              })
            }
          });
        }
      }
    });
  },
  bindDateChange: function (e) {
    console.log('picker发送选择改变，携带值为', e.detail.value)
    this.setData({
      date: e.detail.value
    })
  },
  bindDateChange2: function (e) {
    console.log('picker发送选择改变，携带值为', e.detail.value)
    this.setData({
      date2: e.detail.value
    })
  },
  bindDateChange3: function (e) {
    console.log('picker发送选择改变，携带值为', e.detail.value)
    this.setData({
      date3: e.detail.value
    })
  },
  bindDateChange4: function (e) {
    console.log('picker发送选择改变，携带值为', e.detail.value)
    this.setData({
      date4: e.detail.value
    })
  },
  getDateTime: function (e) {
    console.log('picker发送选择改变，携带值为', e.detail.value)
    this.setData({
      date1: e.detail.value
    })
  },
  bindRelationship0: function (e) {
    var index = e.detail.value;
    var orderPeriod0 = this.data.array0[index];
    var number0 = Number(index) + 1;
    this.setData({
      number0: index,
      pickerIndex0: index,
      orderPeriod0: orderPeriod0
    })
  },
  bindRelationship: function (e) {
    var index = e.detail.value;
    var orderPeriod = this.data.array[index];
    var number = null;
    if (index == '0') {
      this.setData({
        number: '1402',
        pickerIndex: index,
        orderPeriod: orderPeriod
      })
    }
    if (index == '1') {
      this.setData({
        number: '1404',
        pickerIndex: index,
        orderPeriod: orderPeriod
      })
    }
    if (index == '2') {
      this.setData({
        number: '1405',
        pickerIndex: index,
        orderPeriod: orderPeriod
      })
    }
    if (index == '3') {
      this.setData({
        number: '1406',
        pickerIndex: index,
        orderPeriod: orderPeriod
      })
    }
    if (index == '4') {
      this.setData({
        number: '1407',
        pickerIndex: index,
        orderPeriod: orderPeriod
      })
    }
    if (index == '5') {
      this.setData({
        number: '1408',
        pickerIndex: index,
        orderPeriod: orderPeriod
      })
    }
    if (index == '6') {
      this.setData({
        number: '1409',
        pickerIndex: index,
        orderPeriod: orderPeriod
      })
    }
    if (index == '7') {
      this.setData({
        number: '1410',
        pickerIndex: index,
        orderPeriod: orderPeriod
      })
    }
    if (index == '8') {
      this.setData({
        number: '4100',
        pickerIndex: index,
        orderPeriod: orderPeriod
      })
    }
  },
  bindRelationship1: function (e) {
    var index = e.detail.value;
    var orderPeriod1 = this.data.array1[index];
    this.setData({
      number1: index,
      pickerIndex1: index,
      orderPeriod1: orderPeriod1
    })
  },
  bindRelationship2: function (e) {
    var index = e.detail.value;
    var orderPeriod2 = this.data.array2[index];
    var number2 = Number(index) + 1;
    console.log(index)
    this.setData({
      number2: number2,
      pickerIndex2: index,
      orderPeriod2: orderPeriod2
    })
  },
  bindRelationship3: function (e) {
    var index = e.detail.value;
    var orderPeriod3 = this.data.array3[index];
    var number3 = null;
    console.log(index)
    console.log(orderPeriod3)
    this.setData({
      number3: orderPeriod3,
      pickerIndex3: index,
      orderPeriod3: orderPeriod3
    })
  },
  bindRelationship4: function (e) {
    var index = e.detail.value;
    var orderPeriod4 = this.data.array4[index];
    var number4 = null;
    console.log(index)
    this.setData({
      number4: index,
      pickerIndex4: index,
      orderPeriod4: orderPeriod4
    })
  },
  bindRelationship5: function (e) {
    var index = e.detail.value;
    var orderPeriod5 = this.data.array5[index];
    var number5 = Number(index) + 1;
    console.log(index)
    this.setData({
      number5: number5,
      pickerIndex5: index,
      orderPeriod5: orderPeriod5
    })
  },
  bindRelationship6: function (e) {
    var index = e.detail.value;
    var orderPeriod6 = this.data.array6[index];
    var number6 = Number(index) + 1;
    console.log(index)
    this.setData({
      number6: number6,
      pickerIndex6: index,
      orderPeriod6: orderPeriod6
    })
  },
  bindRelationship7: function (e) {
    var index = e.detail.value;
    var orderPeriod7 = this.data.array7[index];
    var number7 = null;
    if (index == '0') {
      this.setData({
        number7: '10',
        pickerIndex7: index,
        orderPeriod7: orderPeriod7
      })
    }
    if (index == '1') {
      this.setData({
        number7: '20',
        pickerIndex7: index,
        orderPeriod7: orderPeriod7
      })
    }
    if (index == '2') {
      this.setData({
        number7: '30',
        pickerIndex7: index,
        orderPeriod7: orderPeriod7
      })
    }
    if (index == '3') {
      this.setData({
        number7: '40',
        pickerIndex7: index,
        orderPeriod7: orderPeriod7
      })
    }
    if (index == '4') {
      this.setData({
        number7: '50',
        pickerIndex7: index,
        orderPeriod7: orderPeriod7
      })
    }
    if (index == '5') {
      this.setData({
        number7: '60',
        pickerIndex7: index,
        orderPeriod7: orderPeriod7
      })
    }
    if (index == '6') {
      this.setData({
        number7: '70',
        pickerIndex7: index,
        orderPeriod7: orderPeriod7
      })
    }
    if (index == '7') {
      this.setData({
        number7: '80',
        pickerIndex7: index,
        orderPeriod7: orderPeriod7
      })
    }
    if (index == '8') {
      this.setData({
        number7: '90',
        pickerIndex7: index,
        orderPeriod7: orderPeriod7
      })
    }
    if (index == '9') {
      this.setData({
        number7: '100',
        pickerIndex7: index,
        orderPeriod7: orderPeriod7
      })
    }
    if (index == '10') {
      this.setData({
        number7: '110',
        pickerIndex7: index,
        orderPeriod7: orderPeriod7
      })
    }
    if (index == '11') {
      this.setData({
        number7: '120',
        pickerIndex7: index,
        orderPeriod7: orderPeriod7
      })
    }
    if (index == '12') {
      this.setData({
        number7: '130',
        pickerIndex7: index,
        orderPeriod7: orderPeriod7
      })
    }
    if (index == '13') {
      this.setData({
        number7: '190',
        pickerIndex7: index,
        orderPeriod7: orderPeriod7
      })
    }
  },
  bindRelationship8: function (e) {
    var index = e.detail.value;
    var orderPeriod8 = this.data.array8[index];
    var number8 = null;
    if (index == '0') {
      this.setData({
        number8: '1',
        pickerIndex8: index,
        orderPeriod8: orderPeriod8
      })
    }
    if (index == '1') {
      this.setData({
        number8: '3',
        pickerIndex8: index,
        orderPeriod8: orderPeriod8
      })
    }
    if (index == '2') {
      this.setData({
        number8: '4',
        pickerIndex8: index,
        orderPeriod8: orderPeriod8
      })
    }
  },
  bindRelationship9: function (e) {
    var index = e.detail.value;
    var orderPeriod9 = this.data.array9[index];
    // var number9 = null;
    var number9 = Number(index) + 1;

    console.log(number9)
    this.setData({
      number9: index,
      pickerIndex9: index,
      orderPeriod9: orderPeriod9
    })
  },
  bindRelationship10: function (e) {
    var index = e.detail.value;
    var orderPeriod10 = this.data.array10[index];
    var number10 = Number(index) + 1;
    console.log(index)
    this.setData({
      number10: index,
      pickerIndex10: index,
      orderPeriod10: orderPeriod10
    })
  },
  bindRelationship11: function (e) {
    var index = e.detail.value;
    var orderPeriod11 = this.data.array11[index];
    var number11 = Number(index) + 1;
    console.log(number11)
    this.setData({
      number11: number11,
      pickerIndex11: index,
      orderPeriod11: orderPeriod11
    })
  },
  bindRelationship12: function (e) {
    var index = e.detail.value;
    var orderPeriod12 = this.data.array12[index];
    var number12 = null;
    this.setData({
      number12: index,
      pickerIndex12: index,
      orderPeriod12: orderPeriod12
    })
  },
  bindRelationship13: function (e) {
    var index = e.detail.value;
    var orderPeriod13 = this.data.array13[index];
    var number13 = Number(index) + 1;
    this.setData({
      number13: number13,
      pickerIndex13: index,
      orderPeriod13: orderPeriod13
    })
  },

  getno: function () {
    var that = this;
    wx.request({
      url: pathUrl + '/rest/base/getno/' + that.data.proNo,
      success: function (res) {
        if (res.data.ok || res.data.data) {
          that.setData({
            orderNo: res.data.data
          })
        } else {
          wx.showModal({
            title: '提示',
            content: '获取数据失败',
            confirmColor: '#7aa6d1',
            showCancel: false
          })
        }
      }
    })
  },
  carPrice: function (e) {
    this.setData({
      carPrice: e.detail.value
    })
  },
  frameNo: function (e) {
    this.setData({
      frameNo: e.detail.value
    })
  },
  engineNo: function (e) {
    this.setData({
      engineNo: e.detail.value
    })
  },
  carBrands: function (e) {
    this.setData({
      carBrands: e.detail.value
    })
  },
  carSeries: function (e) {
    this.setData({
      carSeries: e.detail.value
    })
  },
  carSpecs: function (e) {
    this.setData({
      carSpecs: e.detail.value
    })
  },
  systemCarPrice: function (e) {
    this.setData({
      systemCarPrice: e.detail.value
    })
  },
  dealer: function (e) {
    this.setData({
      dealer: e.detail.value
    })
  },
  dscode: function (e) {
    this.setData({
      dscode: e.detail.value
    })
  },
  contractSfRatio: function (e) {
    this.setData({
      contractSfRatio: e.detail.value
    })
  },
  marketingArchivesNum: function (e) {
    this.setData({
      marketingArchivesNum: e.detail.value
    })
  },
  commissionFeeRate: function (e) {
    this.setData({
      commissionFeeRate: e.detail.value
    })
  },
  sfMoney: function (e) {
    this.setData({
      sfMoney: e.detail.value
    })
  },
  sfProportion: function (e) {
    this.setData({
      sfProportion: e.detail.value
    })
  },
  monthincome: function (e) {
    this.setData({
      monthincome: e.detail.value
    })
  },
  monthhomeincome: function (e) {
    this.setData({
      monthhomeincome: e.detail.value
    })
  },
  property: function (e) {
    this.setData({
      property: e.detail.value
    })
  },
  houseArea: function (e) {
    this.setData({
      houseArea: e.detail.value
    })
  },
  othdebtbal: function (e) {
    this.setData({
      othdebtbal: e.detail.value
    })
  },
  monrepayamt: function (e) {
    this.setData({
      monrepayamt: e.detail.value
    })
  },
  insureamt: function (e) {
    this.setData({
      insureamt: e.detail.value
    })
  },
  loanMoney: function (e) {
    this.setData({
      loanMoney: e.detail.value
    })
  },
  actualLoanAmount: function (e) {
    this.setData({
      actualLoanAmount: e.detail.value
    })
  },
  encbno: function (e) {
    this.setData({
      encbno: e.detail.value
    })
  },

  mortname: function (e) {
    this.setData({
      mortname: e.detail.value
    })
  },
  chnsname: function (e) {
    this.setData({
      chnsname: e.detail.value
    })
  },
  mortltype: function (e) {
    this.setData({
      mortltype: e.detail.value
    })
  },
  mortmtype: function (e) {
    this.setData({
      mortmtype: e.detail.value
    })
  },
  mortstype: function (e) {
    this.setData({
      mortstype: e.detail.value
    })
  },
  mortvalue: function (e) {
    this.setData({
      mortvalue: e.detail.value
    })
  },
  mortaddr: function (e) {
    this.setData({
      mortaddr: e.detail.value
    })
  },
  maxmortrate: function (e) {
    this.setData({
      maxmortrate: e.detail.value
    })
  },
  mortcontrno: function (e) {
    this.setData({
      mortcontrno: e.detail.value
    })
  },
  dbimpno: function (e) {
    this.setData({
      dbimpno: e.detail.value
    })
  },
  bailname: function (e) {
    this.setData({
      bailname: e.detail.value
    })
  },
  bailamount: function (e) {
    this.setData({
      bailamount: e.detail.value
    })
  },
  bailaccno: function (e) {
    this.setData({
      bailaccno: e.detail.value
    })
  },
  bailcontno: function (e) {
    this.setData({
      bailcontno: e.detail.value
    })
  },
  marketId: function (e) {
    this.setData({
      marketId: e.detail.value
    })
  },
  financeCharge: function (e) {
    this.setData({
      financeCharge: e.detail.value
    })
  },
  guaranteeCode: function (e) {
    this.setData({
      guaranteeCode: e.detail.value
    })
  },
  cooperateAgencyCode: function (e) {
    this.setData({
      cooperateAgencyCode: e.detail.value
    })
  },
  insuranceAgencyCode: function (e) {
    this.setData({
      insuranceAgencyCode: e.detail.value
    })
  },
  recommendAgencyCode: function (e) {
    this.setData({
      recommendAgencyCode: e.detail.value
    })
  },
  agencyReceiveAmt1: function (e) {
    this.setData({
      agencyReceiveAmt1: e.detail.value
    })
  },
  name: function (e) {
    this.setData({
      name: e.detail.value
    })
  },
  idCard: function (e) {
    this.setData({
      idCard: e.detail.value
    })
  },
  agencyReceiveAmt2: function (e) {
    this.setData({
      agencyReceiveAmt2: e.detail.value
    })
  },
  addMaterial1: function (e) {
    console.log(e)
    var that = this;
    wx.navigateTo({
      url: '/pages/add33/add33?proNo=' + that.data.proNo + '&proName=' + e.currentTarget.dataset.tit + '&orderNo=' + e.currentTarget.dataset.orderno + '&type=' + e.currentTarget.dataset.type,
    })
  },

  addMaterial2: function (e) {
    console.log(e)
    var that = this;
    wx.navigateTo({
      url: '/pages/add331/add331?proName=' + e.currentTarget.dataset.tit + '&orderNo=' + e.currentTarget.dataset.orderno,
    })
  },

  submitBtn: function () {
    var that = this;
    if (that.data.isSubmit) {
      that.setData({
        isSubmit: false
      });
      var agencyReceiveAmt1 = Number(that.data.agencyReceiveAmt1)
      var agencyReceiveAmt2 = Number(that.data.agencyReceiveAmt2)
      var cocomReceiveAmt   = Number(that.data.cocomReceiveAmt)
      var all = Number(that.data.cocomReceiveAmt) + Number(that.data.agencyReceiveAmt2) + Number(that.data.agencyReceiveAmt1)
      var loanMoney = Number(that.data.loanMoney)
      if (that.data.payeeType == 1){
        
      }
      if (all != loanMoney){
        // wx.showModal({
        //   title: '提示',
        //   content: '机构收款金额1加机构收款金额2加合作单位收款金额必须等于贷款金额',
        //   showCancel:false
        // })
        // return false
      }

      var data = {
        bankCode: that.data.bankCode,
        assurerNo: that.data.assurerNo,
        platNo: that.data.platNo,
        busiCode: that.data.busiCode,
        productType: that.data.productType,
        orderNo: that.data.orderNo,

        signMode: '2',
        reczoneno: that.data.number,
        carPrice: that.data.carPrice,
        carType: that.data.number1,
        frameNo: that.data.frameNo,
        engineNo: that.data.engineNo,
        carBrands: that.data.carBrands,
        carSeries: that.data.carSeries,
        carSpecs: that.data.carSpecs,
        systemCarPrice: that.data.systemCarPrice,


        businessModel: that.data.number2,
        dealer: that.data.dealer,
        dscode: that.data.dscode,
        contractSfRatio: that.data.contractSfRatio,
        repayPeriod: that.data.number3,
        marketingArchivesNum: that.data.marketingArchivesNum,
        commissionFeeRate: that.data.commissionFeeRate,
        willResign: that.data.number4,
        sfMoney: that.data.sfMoney,
        sfProportion: that.data.sfProportion,
        monthincome: that.data.monthincome,
        monthhomeincome: that.data.monthhomeincome,
        property: that.data.property,
        houseArea: that.data.houseArea,
        othdebtbal: that.data.othdebtbal,
        monrepayamt: that.data.monrepayamt,
        insureamt: that.data.insureamt,
        loanMoney: that.data.loanMoney,
        actualLoanAmount: that.data.actualLoanAmount,


        encbno: that.data.encbno,
        mortname: that.data.mortname,
        chnsname: that.data.chnsname,
        apprel: that.data.number5,
        mortltype: that.data.mortltype,
        mortmtype: that.data.mortmtype,
        mortstype: that.data.mortstype,
        mortvalue: that.data.mortvalue,
        mortaddr: that.data.mortaddr,
        encbregdate: that.data.date,
        encbpreddate: that.data.date2,
        maxmortrate: that.data.maxmortrate,
        mortbegdate: that.data.date3,
        mortenddate: that.data.date4,
        mortcontrno: that.data.mortcontrno,
        dbimpno: that.data.dbimpno,
        bailname: that.data.bailname,
        bailamount: that.data.bailamount,
        bailaccno: that.data.bailaccno,
        bailcontno: that.data.bailcontno,

        marketId: that.data.marketId,
        financeCharge: that.data.financeCharge,
        guaranteeCode: that.data.guaranteeCode,


        payMode: that.data.number6,
        payeeType: that.data.number7,
        cooperateAgencyCode: that.data.cooperateAgencyCode,
        insuranceAgencyCode: that.data.insuranceAgencyCode,
        recommendAgencyCode: that.data.recommendAgencyCode,
        agencyReceiveMode1: that.data.number8,
        agencyReceiveAmt1: that.data.agencyReceiveAmt1,
        agencyReceiveType1: that.data.number9,
        agencyReceiveMode2: that.data.number10,
        agencyReceiveAmt2: that.data.agencyReceiveAmt2,
        agencyReceiveType2: that.data.number11,


        // cocomId: that.data.cocomId,
        // cocomInterestFlag: that.data.number12,
        // cocomInterestNo: that.data.cocomInterestNo,
        // cocomReceiveAmt: that.data.cocomReceiveAmt,
        cocomReceiveType: that.data.number13,
        name: that.data.name,
        idCard: that.data.idCard,
      };
      console.log("data:" + JSON.stringify(data));
      wx.request({
        url: pathUrl + '/rest/hrfqjj01Controller' ,
        data: data,
        method: 'POST',
        success: function (res) {
          console.log(res.data)
          if (res.data.ok) {
            that.setData({
              isSubmit: true
            });
            wx.request({
              url: pathUrl + '/rest/hrfqjj01Controller/postfq/' + that.data.orderNo,
              method: 'GET',
              success: function (e) {
                console.log(e)
                if (e.data.ok) {
                  wx.showModal({
                    title: '提示',
                    content: '提交成功，请等待审核人员审核',
                    showCancel: false
                  })
                } else {
                  wx.showModal({
                    title: '提示',
                    content: JSON.parse(e.data.message).msg,
                    showCancel: false
                  })
                }
              }
            })
            wx.showToast({
              title: '提交成功',
              duration: 1000,
              mask: true,
              success: function () {
                // setTimeout(function () {
                //   wx.switchTab({
                //     url: "/pages/index/index"
                //   })
                // }, 1000);
              }
            })
          } else {
            that.setData({
              isSubmit: true
            });
            wx.showToast({
              title: '提交失败',
              icon: 'none',
              mask: true,
              duration: 1000
            })
          }
        }
      })
    } else {
      wx.showToast({
        title: '请勿重复提交',
        icon: 'none',
        mask: true,
        duration: 1000
      })
    }
  },

  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})